import time,uuid

class Slot:
    def __init__(self,role:str,content:str,metadata:dict):
        self.slot_id = uuid.uuid4().hex
        self.role = role
        self.content = content
        self.metadata = metadata or {}
        self.timestamp = int(time.time())


    def to_dict(self):
        return {
            "slot_id": self.slot_id,
            "role": self.role,
            "content": self.content,
            "timestamp": self.timestamp,
            "metadata": self.metadata
        }

if __name__ == '__main__':
    slot = Slot(role="user",content="请帮我推荐一台笔记本",metadata={"key":"value"})
    print(slot.to_dict())


